package com.pureut.quality.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pureut.common.core.exception.GlobalException;
import com.pureut.common.core.utils.bean.BeanUtils;
import com.pureut.quality.domain.AuditNonconformity;
import com.pureut.quality.domain.MeetingRecord;
import com.pureut.quality.domain.dto.AuditNonconformityDto;
import com.pureut.quality.domain.dto.MeetingRecordDto;
import com.pureut.quality.domain.vo.AuditNonconformityVo;
import com.pureut.quality.domain.vo.MeetingRecordVo;
import com.pureut.quality.domain.vo.SubmitVo;
import com.pureut.quality.export.MeetingRecordExport;
import com.pureut.quality.mapper.AuditNonconformityMapper;
import com.pureut.quality.mapper.MeetingRecordMapper;
import com.pureut.quality.service.AuditNonconformityService;
import com.pureut.quality.service.MeetingRecordService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/***
 * 会议纪要
 * Author:C
 * Date:2023/01/19 17:15
 * @DESC
 */
@Service
public class MeetingRecordServiceImpl extends ServiceImpl<MeetingRecordMapper, MeetingRecord> implements MeetingRecordService {

    /**
     * 会议纪要 数据层
     */
    @Resource
    MeetingRecordMapper meetingRecordMapper;


    /**
     * 查询会议纪要列表
     * @param meetingRecordVo
     * @return
     */
    @Override
    public List<MeetingRecordDto> listMeetingRecord(MeetingRecordVo meetingRecordVo) {
        List<MeetingRecordDto> meetingRecordDtos = meetingRecordMapper.listMeetingRecord(meetingRecordVo);
        return meetingRecordDtos;
    }

    /**
     * 查看会议纪要
     * @param id
     * @return
     */
    @Override
    public MeetingRecordDto getInfo(Long id) {
        return meetingRecordMapper.getInfo(id);
    }

    /**
     * 新增会议纪要
     * @param meetingRecordVo
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean insertMeetingRecord(MeetingRecordVo meetingRecordVo) {
        MeetingRecord meetingRecord = new MeetingRecord();
        BeanUtils.copyProperties(meetingRecordVo, meetingRecord);
        return save(meetingRecord);
    }

    /**
     * 修改会议纪要
     * @param meetingRecordVo
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateMeetingRecord(MeetingRecordVo meetingRecordVo) {
        MeetingRecord meetingRecord = new MeetingRecord();
        BeanUtils.copyProperties(meetingRecordVo, meetingRecord);
        meetingRecord.setId(meetingRecordVo.getId());
        return updateById(meetingRecord);
    }

    /**
     * 删除会议纪要
     * @param ids
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean removeMeetingRecord(String ids) {
        return removeById(ids);
    }

//    /**
//     * 导出会议纪要
//     * @param meetingRecordVo
//     * @return
//     */
//    @Override
//    public List<MeetingRecordExport> selectMeetingExport(MeetingRecordVo meetingRecordVo) {
//        return meetingRecordMapper.selectMeetingExport(meetingRecordVo);
//    }

}
